﻿// DigitalDesign
// Project: InformationBoard
// Developer: Montak Oleg
// Created: 23.11.2011
// Last change: 23.11.2011
// Description: implementation of ClientSettingsService - gives the client settings

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Server
{
    public class ClientSettingsService : IClientSettingsService
    {
        private DataModelContainer dataModel;
        public ClientSettingsService()
        {
            dataModel = new DataModelContainer();
        }


        public int GetClientId()
        {
            return 1;
        }

        public ClientSettingsResult GetClientSettings(int clientId)
        {
            var dataResult = new ClientSettingsResult();
            dataResult.IsGood = true;

            try
            {
                var client = dataModel.ClientDevices.Single(c => c.Id == clientId);
                dataResult.Data = new ClientNotEF(client);
            }
            catch (Exception ex)
            {
                Log.Add(this, ex);
                dataResult.IsGood = false;
            }

            return dataResult;
        }
    }
}
